package cn.com.greatwall.kafka.domain;

import java.io.Serializable;
import java.util.Objects;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import cn.com.greatwall.common.base.BaseEntity;
import cn.com.greatwall.system.modules.system.domain.Role;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

/**
 * @Author herw
 * @Time 2021-01-20 14:05:55
 * @Version 1.0
 * @Description: TODO(用一句话描述该文件做什么)
 */
@Entity
@Getter
@Setter
@Table(name = "mq_task")
public class Task extends BaseEntity implements Serializable {
    @Id
    @Column(name = "task_id")
    @ApiModelProperty(value = "ID", hidden = true)
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @ApiModelProperty(value = "集群别名")
    private String clusterIds;

    @ApiModelProperty(value = "用户角色")
    private Long roleId;

    @ApiModelProperty(value = "任务名称")
    private String name;

    @ApiModelProperty(value = "partition")
    @Column(name = "`partition`")
    private Integer partition;

    @ApiModelProperty(value = "replication")
    @Column(name = "`replication`")
    private Short replication;

    @ApiModelProperty(value = "message_rate")
    private Integer messageRate;

    @ApiModelProperty(value = "ttl")
    private Integer ttl;

    @ApiModelProperty(value = "approved")
    private Integer approved = 0;

    @ApiModelProperty(value = "approval_opinions")
    private String approvalOpinions;
    
    @ApiModelProperty(value = "location")
    private String location;

    @ApiModelProperty(value = "备注")
    private String comments;

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        Task task = (Task) o;
        return Objects.equals(id, task.id);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id);
    }
}
